/*
 * @Description: 
 * @Version: 2.0
 * @Autor: 张磊
 * @Date: 2020-11-19 10:51:06
 * @LastEditors: 张磊
 * @LastEditTime: 2020-11-23 16:46:59
 * @FilePath: \marker\src\models\typelist.ts
 */
import { useState } from 'react'
import { type, typeSingle, addCar, getShopData, getCheck, delectShopList,getNavList,getGoods,getGoodDetail, } from '@/api/type';
import { POrtShop, SHopList } from '@/utils/types'



export default function useUserModel() {


  async function getType() {
    let result = await type();
    return result
  }
  async function getTypeSingle(data: string) {
    console.log(data, 901)
    let result = await typeSingle(data)

    return result
  }
  async function getNav(params: string) {
    let result = await getNavList(params);
    return result
  }
  const getGood = async (params: string) => {
    let result = await getGoods(params);
    return result
  }
  const getGoodsDetail = async (params: string) => {
    let result = await getGoodDetail(params);
    // updata(result)
    return result
  }
  async function getCar(data: POrtShop) {
    let result = await addCar(data)
    console.log('zhehsi', result)
    return result
  }
  async function getShop() {
    let res = await getShopData()
    return res
  }
  const shopsPort = async (data: SHopList) => {
    let result = await getCheck(data)
    return result
  }
  const delectShopData = async (data: string) => {
    let result = await delectShopList(data)
    return result
  }
  return {
    getType,
    getTypeSingle,
    getNav,
    getGood,
    getGoodsDetail,
    getCar,
    getShop,
    shopsPort,
    delectShopData,
  }
}